/*
 * 百度在线网络技术（北京）有限公司拥有本软件版权2022并保留所有权利。
 * Copyright 2022, Baidu.com,Inc 2:Baidu Online Network Technology (Beijing) Co.,Ltd,
 * All rights reserved.
 */

package com.azdebugit.hash.map.test.othermap.test;// Java program to demonstrate the example
// of int lastIndexOf(int) method of ArrayList.
 
import java.util.*;
 
public class LastIndexOfArrayList {
    public static void main(String[] args) {
        // Create an ArrayList with initial 
        // capacity of storing elements
 
        ArrayList < String > arr_l = new ArrayList < String > (10);
 
        // By using add() method is to add 
        // elements in this ArrayList
 
        arr_l.add("C");
        arr_l.add("C++");
        arr_l.add("JAVA");
        arr_l.add("DOTNET");
        arr_l.add("PHP");
        arr_l.add("JAVA");
 
        // Display ArrayList
        System.out.println("ArrayList Elements :" + arr_l);
 
        // By using lastIndexOf(Object) method is to
        // return the index of the last occurrence
        // of the given Object in this ArrayList
 
        int index = arr_l.lastIndexOf("JAVA");
 
        // Display Index 
        System.out.println("arr_l.lastIndexOf(JAVA) : " + index);
    }
}

